#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H

#include "../plugin/BasePlugin.h"
#include <QHash>
#include <QObject>
#include <QString>

#include "common_global.h"

class PluginManagerPrivate;

class COMMONSHARED_EXPORT PluginManager : public QObject
{
    Q_OBJECT
private:
    static PluginManager sInst;
public:
    static PluginManager* GetInstance(){
        return &sInst;
    }

    void PreLoadPlugin(QString pluginpath);
    void LoadPlugin(int argc, char **argv);
    void AfterLoadPlugin();

    const QHash<QString,BasePlugin*>& GetAllPlugins();

    BasePlugin* GetPlugin(QString name);

    bool ChoosePlugin();
signals:

public slots:

private:
    PluginManager();
    ~PluginManager();
    PluginManager(const PluginManager&) = delete;
    PluginManager& operator=(const PluginManager&) = delete;

    PluginManagerPrivate* _p = nullptr;
};

#endif // PLUGINMANAGER_H
